package nowcoder.written_examination.toutiao;

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
            int n = scanner.nextInt();
        for (int i = 0; i < n; i++) {
            int cur = scanner.nextInt();
            System.out.println(back(cur,0,0,0,0));
        }
    }
    public static int back(int remain,int red,int yellow,int green,int blue) {
        if (remain < 0) {
            return 0;
        }
        if (remain == 0 && (red + yellow) % 2 == 0 && green % 2 != 0) {
            return 1;
        }
        int res = 0;
        int a = remain - 1;
        int b = red + 1;
        int c = yellow + 1;
        int d = green + 1;
        int e = blue + 1;
        res += back(a,b,yellow,green,blue) +
                back(a,red,c,green,blue) +
                back(a,red,yellow,d,blue) +
                back(a,red,yellow,green,e);
        return res;
    }
}
   /* public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    if ((a[i] ^ a[j]) > m) {
                        cnt++;
                    }
                }
            }
            System.out.println(cnt);
        }
    }
}*/
   /* public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            StringBuilder x = new StringBuilder(in.next());
            int n = in.nextInt();
            for (int i = 0; i < n; i++) {
                int s = in.nextInt();
                int l = in.nextInt();
                StringBuilder str = new StringBuilder(x.substring(s,s + l));
                x.insert(s + l,str.reverse());
            }
            System.out.println(x);
        }
    }
}*/
    /*public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int x = in.nextInt();
            int k = in.nextInt();
            int cnt = 0;
            int i = 1;
            while (cnt != k) {
                if ((x + i) == (x | i)) {
                    cnt++;
                }
                i++;
            }
            System.out.println(--i);
        }
    }
}
*/